package com.betterjr.modules.risk.api.service;

import java.util.Map;

import org.springframework.stereotype.Service;

import com.alibaba.dubbo.config.annotation.Reference;
import com.betterjr.common.utils.Collections3;
import com.betterjr.common.web.AbstarctRemoteApiInvoke;
import com.betterjr.common.web.AjaxRemoteApiParam;
import com.betterjr.modules.agreement.IScfElecAgreementService;

/**
 * 
 * @ClassName: RemoteApiSendValidCodeInvokeService 
 * @Description: 合同签署
 * @author xuyp
 * @date 2018年7月7日 下午4:32:43 
 *
 */
@Service
public class RemoteApiSendValidCodeInvokeService extends AbstarctRemoteApiInvoke {

    @Reference(interfaceClass = IScfElecAgreementService.class)
    private IScfElecAgreementService scfElecAgreementService;

    private String apiCode = "RAI00008";

    @Override
    public String saveOrFindInvoke(AjaxRemoteApiParam param) {

        return scfElecAgreementService.webSendValidCode(findProperties(param.getParamMap(), "appNo"),
                findProperties(param.getParamMap(), "custType", "6"),
                findProperties(param.getParamMap(), "vCode", "123456"));
    }

    @Override
    public boolean supportInvoke(String anApiCode) {

        return apiCode.equals(anApiCode);
    }

    @Override
    public boolean checkParam(Map<String, Object> anParamMap) {

        boolean flag = true;

        if (flag && Collections3.isEmpty(anParamMap)) flag = false;

        if (flag && !anParamMap.containsKey("appNo")) flag = false;

        return flag;

    }

}
